<?php



      header("Content-Type: text/html;charset=utf-8"); 

       require "../gobal.php";

       $vid=$_GET["vid"] ;

       $sql="select DISTINCT(group_name) from device_issue  where device_id=$vid order by id asc";



       $groups = fetch_rows($sql) ;  

         $sql="select * from device_issue where device_id=$vid";

       $issues=fetch_rows($sql);

       $sql="select * from device where id=$vid";

       $devices=fetch_rows($sql);




       $device=$devices[0];



?>



<div class="navbar">
  <div class="navbar-inner">
    <div class="left sliding"><a href="index.html" class="back link"><i class="icon icon-back"></i></a></div>
    <div class="center sliding">选择故障</div>
    <div class="right"><a href="customer/center.php" class="link icon-only"><i class="icon icon-user"></i></a></div>
  </div>
</div>
<div class="pages navbar-through">
  <div data-page="fix-page" class="page">
    <div class="selected-device-info color-orange" style=" position: fixed; top:44px; z-index:99; width:100%;border-bottom: 1px solid #e7e7e7;">已选择机型：<span class="selected-device-name" data-basetext="iPhone 4"><?php echo $device["name"] ?></span></div>
    <div class="page-content" style=" padding-bottom:80px; padding-top: 80px; ">

                  <div class="list-title">颜色</div>
                  <div class="select-list-block">
                    <ul style=" margin:0;">

                    
                        <li class="color-attr-item">
							
							   <?php 
                                 $color_codes=explode(",",$device["colors"]);

                                 foreach($color_codes as $color_code){

										 $colorName=getColorName($color_code);
                                         $colorRGB=getColorRGB($color_code);
										 echo "<div class='item-color click-active' style='background:$colorRGB' data-val='$color_code' data-text='$colorName'><span class='item-color-text'>$colorName</span></div>";

									 }

							    ?>



                        </li>
                    
                    </ul>
                  </div>
		           
		
		           <div class="accordion-list">

		          <?php
                          $i=0;
                          foreach($groups as $group){
                                $expend_cls=$i++==0?"accordion-item-expanded":"";
                                $group_name=$group["group_name"];
                                 echo "<div class='accordion-item $expend_cls'>";
                                 echo "<div class='list-title accordion-item-toggle' style='font-size:1.3em;padding-top:2px !important;padding-bottom:2px !important;border-bottom:1px dashed; background-color:#F0FFFF }'>$i.".$group_name."</div><div class='select-list-block accordion-item-content'><ul style='margin:0;'>";

                                 foreach($issues as $issue){

							      if ($group_name!= $issue["group_name"]) continue;

                                  echo "<li class='click-active' data-val='".$issue["id"]."' data-price='".$issue["repair_amount"]."' >";
                                  echo "<div class='item-context'><div class='item-title'>".$issue["name"]."&nbsp;&nbsp;<span></span></div></div>";
                                  echo "<div class='item-select'><i class='icon icon-select'></i></div></li>";

								 }

							     echo  "</ul></div></div>";
						  }

		          ?>
                   </div>

    </div>
    <div class="bottom-total-info">已选故障数：<span id="total-fix-count" class="color-blue">0</span>&nbsp;&nbsp;&nbsp;维修预估：<span id="total-fix-price" class="color-orange">￥0.00</span><div class="button btn-disable btn-confirm-order">确认</div></div>
  </div>
</div>
